package cn.com.wxd.util.service;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
 * Title:ProjectInfo.java
 * Description:cn.com.wxd.util.service
 * 
 * Company: Amumu管理平台
 * Copyright: Copyright (c) 2015
 * All right reserved.
 * Created time: 2015-10-27 下午2:51:15
 *
 * @author WangXuDong
 * @version 1.0
 * 项目信息工具类
 */
public final class ProjectInfo implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -463200519990201474L;

	private static final Logger log = LoggerFactory.getLogger(ProjectInfo.class);
	
	private static String projectName;
	private static String companyName;
	private static String version;
	private static String copyright;
	private static String description;
	private static String author;
	private static boolean sysCheckSms;
	private static boolean sysCheckEmail;
	private static boolean rememberUser;
	private static String domainName;
	
	static  {    
		init();
	 }
	public static void init(){
		Properties prop =  new  Properties();        
        try  { 
       	InputStream inputStream = ProjectInfo.class.getResourceAsStream("/wxd.properties");  
	        BufferedReader bf = new BufferedReader(new    InputStreamReader(inputStream));  
           prop.load(bf);
           
           companyName = prop.getProperty("CompanyName");
           projectName = prop.getProperty( "ProjectName" );    
           version = prop.getProperty( "Version" );
           copyright = prop.getProperty( "Copyright" );    
           description = prop.getProperty( "Description" );      
           author = prop.getProperty( "Author" );
           setDomainName(prop.getProperty( "DomainName" ));
           sysCheckSms = Boolean.parseBoolean(prop.getProperty( "Sys-check-sms" ));
           sysCheckEmail = Boolean.parseBoolean(prop.getProperty( "Sys-check-email" ));
           rememberUser = Boolean.parseBoolean(prop.getProperty( "RememberUser" ));
       }  catch  (Exception e) {
            log.info("wxd.properties项目配置文件读取错误",e);
       } 
	}
	public static String getProjectName() {
		return projectName;
	}
	public static String getVersion() {
		return version;
	}
	public static String getCopyright() {
		return copyright;
	}
	public static String getDescription() {
		return description;
	}
	public static String getAuthor() {
		return author;
	}
	public static String getCompanyName() {
		return companyName;
	}
	public static boolean isSysCheckSms() {
		return sysCheckSms;
	}
	public static boolean isSysCheckEmail() {
		return sysCheckEmail;
	}
	public static boolean isRememberUser() {
		return rememberUser;
	}
	public static String getDomainName() {
		return domainName;
	}
	public static void setDomainName(String domainName) {
		ProjectInfo.domainName = domainName;
	}

}
